﻿module CodeCamp01
{
  import CodeCamp00;

  // Sponsor Type
  
  type SponsorType
  {
    Id : Integer32 => AutoNumber();
    EventId : Event where value in Events;
    Name : Text where value.Count <= 128;
  }
    
  SponsorTypes : { SponsorType* } where
    identity Id,
    unique( Name, EventId );
     
  // SponsorImage
  
  type SponsorImage
  {
    Id : Integer32 => AutoNumber();
    ImageUrl : Text where value.Count <= 1024;
    ImageHeight : Integer32;
    ImageWidth : Integer32;
  }
  
  SponsorImages : { SponsorImage* } where
    identity Id;
    
  // Sponsor
    
  type Sponsor
  {
    Id : Integer32 => AutoNumber();
    EventId : Event where value in Events;
    Name : Text where value.Count <= 128;
    SponsorTypeId : SponsorType where value in SponsorTypes;
    Url : Text where value.Count <= 1024;
    ImageId : SponsorImage? where value in SponsorImages;
  }
    
  Sponsors : { Sponsor* } where
    identity Id,
    unique( Name, EventId );

}
